﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Disk_Pizza_Admin
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnEntrar_Click(object sender, EventArgs e)
        {
            logar();
            
        }

        private void logar()
        {
            if (VerificaLoginValido())
            {
                MessageBox.Show("Bem-vindo Administrador");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                errorProvider1.SetError(txtLogin, "Autenticação incorreta.");
            }
        }
        private bool VerificaLoginValido()
        {
            if (txtLogin.Text.Equals("admin") && (txtSenha.Text.Equals("123")))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Close();
        }

        private void txtSenha_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)System.Windows.Forms.Keys.Enter)
            {
                logar();
            }
        }


    }
}
